package com.work.formaldehyde.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;

import androidx.appcompat.app.AppCompatActivity;

import com.umeng.analytics.MobclickAgent;
import com.work.formaldehyde.R;
import com.work.formaldehyde.activityadapter.KePuListAdapter;
import com.work.formaldehyde.activityadapter.MsgListAdapter;
import com.work.formaldehyde.util.ApiUtils;

import java.util.ArrayList;

public class MsgListActivity extends AppCompatActivity implements View.OnClickListener {

    private ImageView kepu_comeback;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ApiUtils.ActivityIsLogin(this, 1);
        setContentView(R.layout.activity_msg_list);
        kepu_comeback = findViewById(R.id.kepu_comeback);
        kepu_comeback.setOnClickListener(this);
        if (ApiUtils.isNetworkConnected(MsgListActivity.this))
            inti();
    }

    private ArrayList<String> new_list_view;
    private ListView home_msg_list;
    @Override
    public void onResume() {
        super.onResume();
        MobclickAgent.onResume(this);
    }
    @Override
    public void onPause() {
        super.onPause();
        MobclickAgent.onPause(this);
    }
    /**
     * 初始加载视图
     */
    public void Init() {
        home_msg_list = findViewById(R.id.home_msg_list);
        new_list_view = new ArrayList<>();
        for (int i = 0; i < 1; i++) {
            new_list_view.add("" + i);
        }
        MsgListAdapter myAdapter = new MsgListAdapter(new_list_view,
                MsgListActivity.this);
        home_msg_list.setAdapter(myAdapter);
    }

    /**
     * 初始化加载调用方法
     */
    public void inti() {
        Init();
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.kepu_comeback:
                onBackPressed();
                break;
        }
    }
}
